<?php
/* @var $this OrderController */
/* @var $model Order */
$this->breadcrumbs=array(
	'综合控制台'=>array($this->pre_module_url.'/index/index'),
	'订单管理'=>array($this->pre_module_url.'/orderSale/saleorder'),
	'订单详细'
);
?>
<?php 
if($model->zo_status=1&&$model->zo_pay_status=1){
		//订单状态=1确认订单，支付状态=1未支付，
		$orderstatus = 1; //等待买家付款
		$status[1] = '未付款';
}elseif($model->zo_status=1&&$model->zo_pay_status=2&&$model->zo_exp_status==1){
		//订单状态=1确认订单，支付状态=2已支付，配送状态=1未配送
		$orderstatus = 2; //等待卖家发货
		$status[1] = '已付款';
}elseif($model->zo_status=1&&$model->zo_pay_status=2&&$model->zo_exp_status==2){
		//订单状态=1确认订单，支付状态=2已支付，配送状态=2已发货
		$orderstatus = 3; //等待买家确认收货
		$status[1] = '已发货';
}elseif($model->zo_status=3&&$model->zo_pay_status=2&&$model->zo_exp_status==5){
		//订单状态=1确认订单，支付状态=2已支付，配送状态=5确认收货
		$orderstatus = 4; //交易成功
		$status[1] = '交易成功';
}elseif($model->zo_status=3&&$model->zo_pay_status=2&&$model->zo_exp_status==4){
		//订单状态=1确认订单，支付状态=2已支付，配送状态=4买家申请换货
		$orderstatus = 5; //买家申请换货
		$status[1] = '申请换货';
}elseif($model->zo_status=3&&$model->zo_pay_status=2&&$model->zo_exp_status==3){
		//订单状态=1确认订单，支付状态=2已支付，配送状态=3换货成功
		$orderstatus = 6; //交易成功，换货成功
		$status[1] = '换货成功';
}elseif($model->zo_status=3&&$model->zo_pay_status=4){
		//订单状态=1确认订单，支付状态=4申请退款
		$orderstatus = 7; //买家申请退款
		$status[1] = '申请退款';
}elseif($model->zo_status=3&&$model->zo_pay_status=3){
		//订单状态=1确认订单，支付状态=4申请退款
		$orderstatus = 8; //退款成功
		$status[1] = '退款成功';
}elseif($model->zo_status=2){
		//订单状态=1确认订单，支付状态=4申请退款
		$orderstatus = 9; //作废订单
		$status[1] = '交易关闭';
}

$comment = array(
		'1'=>'双方都未互评',
		'2'=>'买家已评价',
		'3'=>'卖家已评价',
		'4'=>'双方已互评',
);
?>


<!--已付款 start--> 
<div class="remind_box mt10">
	<div class="order_status line_24">
		<?php if($orderstatus==1){ ?>
			<h3 class="fs_14">当前订单状态：买家已确认订单，等待买家付款</h3>
			<p>1. 提醒卖家发货， <?php echo CHtml::link('和买家联系',"http://wpa.qq.com/msgrd?V=1&amp;Uin=".$model->member->more->zmp_qq."&amp;Menu=yes") ?></p>
		<?php }elseif($orderstatus==2){ ?>
			<h3 class="fs_14">当前订单状态：买家已付款，等待卖家发货</h3>
			<p>1. 提醒卖家发货， <?php echo CHtml::link('现在就去发货',array('delivery','id'=>$model->zo_id),array('class'=>'c_06c'))?></p>
		<?php }elseif($orderstatus==3){ ?>
			<h3 class="fs_14">当前订单状态：卖家已发货，等待买家确认收货</h3>
			<p>1. 提醒卖家发货， <?php echo CHtml::link('和买家联系',"http://wpa.qq.com/msgrd?V=1&amp;Uin=".$model->member->more->zmp_qq."&amp;Menu=yes") ?></p>
		<?php }elseif($orderstatus==4){ ?>
			<h3 class="fs_14">当前订单状态：交易成功</h3>
			<p>1. 提醒卖家发货， <?php echo CHtml::link('和买家联系',"http://wpa.qq.com/msgrd?V=1&amp;Uin=".$model->member->more->zmp_qq."&amp;Menu=yes") ?></p>
		<?php }elseif($orderstatus==5){ ?>
			<h3 class="fs_14">当前订单状态：买家申请换货</h3>
			<p>1. 提醒卖家发货， <?php echo CHtml::link('和买家联系',"http://wpa.qq.com/msgrd?V=1&amp;Uin=".$model->member->more->zmp_qq."&amp;Menu=yes") ?></p>
		<?php }elseif($orderstatus==6){ ?>
			<h3 class="fs_14">当前订单状态：换货成功</h3>
			<p>1. 提醒卖家发货， <?php echo CHtml::link('和买家联系',"http://wpa.qq.com/msgrd?V=1&amp;Uin=".$model->member->more->zmp_qq."&amp;Menu=yes") ?></p>
		<?php }elseif($orderstatus==7){ ?>
			<h3 class="fs_14">当前订单状态：买家申请退款</h3>
			<p>1. 提醒卖家发货， <?php echo CHtml::link('和买家联系',"http://wpa.qq.com/msgrd?V=1&amp;Uin=".$model->member->more->zmp_qq."&amp;Menu=yes") ?></p>
		<?php }elseif($orderstatus==8){ ?>
			<h3 class="fs_14">当前订单状态：退款成功</h3>
			<p>1. 提醒卖家发货， <?php echo CHtml::link('和买家联系',"http://wpa.qq.com/msgrd?V=1&amp;Uin=".$model->member->more->zmp_qq."&amp;Menu=yes") ?></p>
		<?php }elseif($orderstatus==9){ ?>
			<h3 class="fs_14">当前订单状态：交易关闭</h3>
			<p>关闭类型：买家取消订单</p>
			<p>原因：我不想买了</p>
		<?php }?>
		<div class="logistics_box">
			<h3 class="c_666">物流信息</h3>
			<ul class="c_f list">
				<li><span class="tit">发货方式：</span><span>&nbsp;<?php echo $model->express->ze_title?></span></li>
				<li><span class="tit">物流公司：</span><span>&nbsp;<?php echo Express::model()->getExpressCom($model->zo_express_com)?></span></li>
				<li><span class="tit">运单号码：</span><span>&nbsp;<?php echo $model->zo_express_id?></span></li>
				<li class="c_f"><span class="tit">物流跟踪：</span><a href="#expinfo"></a>
					<span id="expinfo"></span>
				</li>
			</ul>
		</div>
	
	</div>
</div>
<!--已付款 end-->


<!--订单信息 start-->
 <div class="order_info mt10">
	<div class="hd"><h2 class="fs_14">订单信息</h2></div>
	<div class="bd">
		<form method="post" action="">
		<div class="address_box">
			<ul class="c_f">
				<li>
					<span class="tit">收货地址：</span>
					<span>
						<?php echo $model->zo_name; //联系人 ?>，
						<?php echo $model->zo_address; //地址 ?>，
						<?php echo $model->zo_telphone; //手机号码?>,
						<?php echo $model->zo_address; //固定电话 ?>,
						<?php echo $model->zo_zip;  //邮编 ?>
					</span>
				</li>
				<li>
					<span class="tit">买家留言：</span>
					<span><?php echo $model->zo_postscript; //买家留言 ?></span>
				</li>
			</ul>
		</div>
		</form>
		<div class="info_box">
			<span class="fw_b c_666">订单信息：</span>
				<span class="mr">订单编号：<?php echo CHtml::encode($model->zo_id)?></span>
				<span class="mr">
					<?php if($model->zo_status===3){?>
						成交时间：<?php echo CHtml::encode(date('Y-m-d H:m:s',$model->zo_voer_time)); ?>
					<?php }else{ ?>
						下单时间：<?php echo CHtml::encode(date('Y-m-d H:m:s', $model->zo_create_time)); ?>
					<?php } ?>
				</span>
		<span><a class="c_06c mr5" href="javascript:" title="">买家：</a>
			<?php echo CHtml::link(CHtml::image("http://wpa.qq.com/pa?p=1:{$model->member->more->zmp_qq}:47"),"http://wpa.qq.com/msgrd?V=1&amp;Uin=".$model->member->more->zmp_qq."&amp;Menu=yes")?>
		</span>
		</div>
		<table class="list_table" cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<th width="35%" class="bd_l">宝贝</th>
				<th width="12%">状态</th>
				<th width="10%">单价（元）</th>
				<th width="8%">数量</th>
				<th width="13%">优惠</th>
				<th width="12%">商品总价（元）</th>
				<th width="10%" class="bd_r">运费（元）</th>                                                       
			</tr>
			<?php foreach($model->orderProduct as $key=>$product){?>
			<tr>
				<td class="pro tl">
					<div class="c_img c_img50">
						<?php echo CHtml::link(Tool::thumb($product->zop_pic,50,50),array('/home/product/detail','id'=>$product->zp_id),array('class'=>'c_06c','target'=>'_blank'))?>
					</div>
					<p class="title_pro line_18">
						<?php echo CHtml::link(str_cut($product->zop_title,40),array('/home/product/detail','id'=>$product->zp_id),array('class'=>'c_06c','target'=>'_blank'))?>
					</p>
					<p class="other c_999">
						<?php foreach(unserialize($product->zop_spe) as $key2=>$val){?>
							<span class="mr10"><?php echo $val?></span>
						<?php } ?>
					</p>
				</td>
				<td><span><?php echo $status[$orderstatus] ?></span>
					<?php if($model->zo_status==3 && ($model->zo_comment==3||$model->zo_comment==4)){ ?><br><span class=""> <?php echo $comment[$model->zo_comment]?></span><?php }?>
				</td>
				<td><?php echo $product->zop_price?></td>
				<td><?php echo $product->zop_nums?></td>
				<td>优惠:省 <?php echo $product->zop_real_price-$product->zop_price*$product->zop_nums?>元 </td>
				<td><?php echo $product->zop_real_price?></td>
				<?php if( $key==0 ){?>
				<td rowspan="<?php echo count($model->orderProduct)?>"><?php echo $model->zo_real_freight?></td>
				<?php } ?>
			</tr>
			<?php }?>
		</table>
		<div class="price_box t_r">
			<p class="fw_b"><span class="fs_14 c_666">实付款：</span><span class="fs_24 c_f60 ff_yh price">&yen;<?php echo $model->zo_amount?></span></p>
		</div>
	</div>
 </div>
<!--订单信息 end-->
 

<?php if(!empty($model->expressCom)){?>
<script language="javascript">
//物流信息
	$(document).ready(function()
	{
			$("#expinfo").html('loading...');
			var expressid = '<?php echo $model->expressCom->zec_com?>';
            var expressno = '<?php echo $model->zo_express_id?>';
			$.get("/snoopy/express",{com:expressid,nu:expressno},
				function(data)
				{
				$("#expinfo").html(data);
				}
			); 
	});
</script>
<?php }?>